<template>
	<view class="content" style="box-sizing: border-box;">
		<!-- 广告页 -->
		<swiper :autoplay="false" :interval="100" :duration="100" class="swiper" :style="{'height':windowHeight}">
			<swiper-item :style="{'height':windowHeight}">
				<view class="" style="width: 100%;height: 100%;position: relative;" mode="widthFix" :style="{'height':windowHeight}">
					<image :src="piclunbo1.img" style="width: 100%;height: 100%;" mode="widthFix" :style="{'height':windowHeight}"></image>
					<view class="qidongye_1" @click="goindex()">
					</view>
				</view>
			</swiper-item>
			<swiper-item :style="{'height':windowHeight}">
				<view class="" style="width: 100%;height: 100%;position: relative;" mode="" :style="{'height':windowHeight}">
					<image :src="piclunbo2.img" style="width: 100%;height: 100%;" mode="" :style="{'height':windowHeight}"></image>
					<view class="qidongye_1" @click="goindex()">
					</view>
				</view>
			</swiper-item>
			<swiper-item :style="{'height':windowHeight}">
				<view class="" style="width: 100%;height: 100%;position: relative;display : flex;" mode="" :style="{'height':windowHeight}">
					<image :src="piclunbo3.img" style="width: 100%;height: 100%;" mode=""></image>
					<view class="qidongye_3" @click="goindex()">
					</view>
				</view>
			</swiper-item>
		</swiper>

	</view>
</template>
<script>
	import Require from '@/common/require.js';
	export default {
		data() {
			return {
				windowHeight: '603px', //定义手机屏幕高度值变量
				piclunbo1:'',
				piclunbo2:'',
				piclunbo3:'',
			}
		}, 
		onLoad() {
			var _me = this;
			uni.getSystemInfo({ //获取手机屏幕高度信息，让swiper的高度和手机屏幕一样高
				success: function(res) {
					_me.windowHeight = res.windowHeight + 'px';
				}
			});
			_me.get_lunbo()
		},
		onShow() {
		},
		methods: {
			// 签到状态
			get_lunbo() {
				var self = this;
				Require.commonRequest({
					url: '/api/guide/all',
					success: function(ret) {
						if (ret.data.code == 200) {
							console.log(ret.data.data)
							self.piclunbo1=ret.data.data[0]
							self.piclunbo2=ret.data.data[1]
							self.piclunbo3=ret.data.data[2]
						} else {
							uni.showToast({
								icon: 'none',
								title: ret.data.msg,
							});
						}
					},
					fail: function() {
						uni.showToast({
							icon: "none",
							title: "网络异常，请稍后再试"
						})
					}
				})
			},
			goindex() {
				uni.setStorage({
				  key: 'launchFlag',
				  data: true
				});
				uni.switchTab({
					url: '../index/index'
				})
			},
		}
	}
</script>
<style>
	.swiper {
		width: 100%;
	}

	.qidongye_1 {
		position: absolute;
		top: 40rpx;
		right: 35rpx;
		width: 120rpx;
		height: 50rpx;
	}

	.qidongye_3 {
		position: absolute;
		width: 100%;
		bottom: 5%;
		height: 100rpx;
	}
</style>
